<?php

include( "./admin/include/func.php");

if( User::get_id() != 3 ) {header( 'Location: index.php');exit();}

$panels = array ();

$g_id  = isset( $_GET['sorszam']) ? (int) $_GET['sorszam'] : 0;
$g_kod = isset( $_GET['kod']) ? trim( strip_tags( $_GET['kod'])) : '';

$db->sql = "SELECT kep,nev,email,telefon,targy,szoveg,rovat,ar,telepules,regio,weblap,feladas 
            FROM hirdetes 
            WHERE id='$g_id' AND aktivkod='$g_kod' AND aktiv=1";
$db->query();	
//print $db->sql;

if (mysql_num_rows( $db->rs) < 1) {
	
	$error_panel = array (
		'caption' => 'Hiba',
		'title'   => 'Hiba!',
		'body'    => "<ul class='errors'>Nem létező vagy nem aktív hirdetés!</ul>",
		'height'  => 20
	);
	
	array_unshift( $panels, $error_panel);
		
} else {
				
	$db->sql = "UPDATE hirdetes 
				SET szponzoralt='1',sponsoredon=NOW(),lastmodified=NOW() 
				WHERE id='$g_id' AND aktivkod='$g_kod'";					   
	$db->query();
	//print $db->sql;
			
	$panels = array ();
	
	$panel = array (
		'caption' => 'Információ',
		'title'   => 'Sikeres kiemelés!',
		'body'    => "<p class='success'>A hirdetés kiemelve!<br /><a href='javascript:history.back()'>Vissza</a> &nbsp; | &nbsp; <a href='hirdetesek.php?sorszam=$g_id'>Hirdetés megtekintése</a></p>",
		'height'  => '50'
	);
	
	array_push( $panels, $panel);
}

?>

<?php include ("header.php"); ?>

<?php include ("top.php"); ?>

<?php include ("left.php"); ?>
							
<div id="middle">

<?php foreach( $panels as $panel) { ?>
	
	<div class="form-panel">		
		<div>
			<img src='./images1/x3a2.gif' width="21px" height="42px" class="fleft" alt='apróhirdetés' /> 
			<div class="hptop">
				<p class="hpcaption"><?php print $panel['caption']; ?></p>
				<p class="hptitle"><?php print $panel['title']; ?></p>
			</div>	
			<img src='./images1/x3b2.gif' width="21px" height="42px" class="fleft" alt='apróhirdetés' />
		</div>
		<div>
			<img src='./images1/x4a.gif' width="21px" height="13px" class="fleft" alt='apróhirdetés' /> 
			<img src='./images1/x4bg.gif' width="455px" height="13px" class="fleft" alt='apróhirdetés' /> 
			<img src='./images1/x4b.gif' width="21px" height="13px" class="fleft" alt='apróhirdetés' />
		</div>
		<div>
			<img src='./images1/x5bga.gif' width="21px" height="<?php print $panel['height']; ?>px" class="fleft" alt='apróhirdetés' /> 
			<div class="hpbody" style="height:<?php print $panel['height']; ?>px">
				<?php if ($panel['body'] != '') print $panel['body']; else { ?>

				<?php } ?>           			
			</div>
			<img src='./images1/x5bgb.gif' width="21px" height="<?php print $panel['height']; ?>px" class="fleft" alt='apróhirdetés' />
		</div>
		<div>
			<img src='./images1/x6a.gif' width="21px" height="34px" class="fleft" alt='apróhirdetés' /> 
			<img src='./images1/x6bg.gif' width="455px" height="34px" class="fleft" alt='apróhirdetés' /> 		
			<img src='./images1/x6b.gif' width="21px" height="34px" class="fleft" alt='apróhirdetés' />
		</div>
	</div>

	<br />
	<br />

<?php } ?>

<br />

</div>

<?php include ("right.php"); ?>

<?php include ("footer.php"); ?>
